package edu.ucsd.db.bassarisk.algebra.logical;

import edu.ucsd.db.bassarisk.algebra.logical.visitor.LogicalOperatorVisitor;
import edu.ucsd.db.bassarisk.algebra.logical.visitor.LogicalPlanPrinter;
import edu.ucsd.db.bassarisk.query.binding.BindingTuple;

public abstract class LogicalOperator {
  private BindingTuple outputDesciptor;
  
  public abstract <R, A> R accept(LogicalOperatorVisitor<R, A> visitor, A arg);
  
  public final String prettyPrint() {
    StringBuilder sb = new StringBuilder();
    LogicalPlanPrinter printer = new LogicalPlanPrinter(0);
    this.accept(printer, sb);
    return sb.toString();
  }

  public BindingTuple getOutputDesciptor() {
    return outputDesciptor;
  }

  public void setOutputDesciptor(BindingTuple outputDesciptor) {
    this.outputDesciptor = outputDesciptor;
  }
}
